package com.example.demo.service.impl;

import com.example.demo.dao.WuZiDao;
import com.example.demo.entity.Ruku;
import com.example.demo.entity.Wuzi;
import com.example.demo.service.WuZiService;
import com.example.demo.vo.WuziVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class WuZiServiceImpl implements WuZiService {

    @Autowired
    private WuZiDao wuZiDao;

    @Override
    public List<WuZiDao> findAll(){
        return wuZiDao.findAll();
    }

    @Override
    public List<WuziVO> findByWzname(String wzname){
        return wuZiDao.findByWzname(wzname);
    }

    @Override
    public int insert(Wuzi wuzi){
        int r = wuZiDao.insert(wuzi);
        return r;
    }

    @Override
    public int delete(String wzname){
        int r = wuZiDao.delete(wzname);
        return r;
    }

    @Override
    @Transactional
    public int update(Wuzi wuzi){
        int r = wuZiDao.update(wuzi);
        return r;
    }

    @Override
    @Transactional
    public int rukuUpdate(Ruku ruku){
        int r = wuZiDao.rukuUpdate(ruku);
        return r;
    }

    @Override
    public List<WuziVO> findRuku() {
        return wuZiDao.findRuku();
    }

    @Override
    public int UprkNums(Wuzi wuzi){
        int r = wuZiDao.UprkNums(wuzi);
        return r;
    }

    @Override
    public int UpckNums(Wuzi wuzi){
        int r = wuZiDao.UpckNums(wuzi);
        return r;
    }
}
